package com.online.onlineshop.utils;


import lombok.*;
import org.apache.ibatis.annotations.ConstructorArgs;
import java.io.Serializable;

/*
* 采用json来向前端传入信息
*
* */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class ResultForFrontEnd<E>  implements Serializable {
    /*状态码*/
    private Integer stateCode;
    /* 消息 */
    private String msg;
    /*数据*/
    private E data;

    public ResultForFrontEnd(E data) {
        this.data = data;
    }

    public ResultForFrontEnd(Throwable e) {
        this.msg = e.getMessage();
    }

    public ResultForFrontEnd(Integer stateCode) {
        this.stateCode = stateCode;
    }

    public ResultForFrontEnd(Integer stateCode, E data) {
        this.stateCode = stateCode;
        this.data = data;
    }
}

